Damien Lefebvre - December 2022

Sources:
import warnings
warnings.simplefilter(action='ignore', category=FutureWarning)
import datetime
import pandas as pd
import plotly.express as px
import plotly.io as pio
# pio.templates.default = "plotly_dark"
from all_episodes import unique_episodes, repeat_episodes, tv_shows
unique_episodes_df = pd.DataFrame(unique_episodes, columns=["Title", "Hosts"])
unique_episodes_df
| Title | Hosts | |
|---|---|---|
| 0 | Man on Fire | Bill Simmons and Chris Ryan |
| 1 | Planes, Trains, and Automobiles | Bill Simmons and Van Lathan |
| 2 | Body Heat | Bill Simmons, Mallory Rubin, and Wesley Morris |
| 3 | Blow Out | Bill Simmons, Chris Ryan, Sean Fennessey, and ... |
| 4 | Cruising | Bill Simmons, Chris Ryan, and Wesley Morris |
| ... | ... | ... |
| 259 | Heat | Bill Simmons and Chris Ryan |
| 260 | White Men Can't Jump | Bill Simmons, Chris Ryan, and Rembert Browne |
| 261 | Moneyball | Bill Simmons and Chris Ryan |
| 262 | Blue Chips | Bill Simmons, Chris Ryan, and Mark Titus |
| 263 | Any Given Sunday | Bill Simmons and Chris Ryan |
264 rows × 2 columns
film_data = pd.read_csv("film_data.csv")
assert not film_data[film_data.duplicated()].shape[0]
film_data.Released = pd.to_datetime(film_data.Released)
film_data.BoxOffice = film_data.BoxOffice.str.replace("$", "").str.replace(",", "").astype(float)
film_data.loc[:4, ["Title", "Released", "Genre", "Director", "Writer"]]
| Title | Released | Genre | Director | Writer | |
|---|---|---|---|---|---|
| 0 | Margin Call | 2011-09-29 | Drama, Thriller | J.C. Chandor | J.C. Chandor |
| 1 | Singles | 1992-09-18 | Comedy, Drama, Music | Cameron Crowe | Cameron Crowe |
| 2 | Tango & Cash | 1989-12-22 | Action, Comedy, Crime | Andrey Konchalovskiy, Albert Magnoli | Randy Feldman |
| 3 | Saving Private Ryan | 1998-07-24 | Drama, War | Steven Spielberg | Robert Rodat |
| 4 | Scent of a Woman | 1993-01-08 | Drama | Martin Brest | Giovanni Arpino, Bo Goldman, Ruggero Maccari |
pd.DataFrame(film_data.columns)
| 0 | |
|---|---|
| 0 | Title |
| 1 | Year |
| 2 | Rated |
| 3 | Released |
| 4 | Runtime |
| 5 | Genre |
| 6 | Director |
| 7 | Writer |
| 8 | Actors |
| 9 | Plot |
| 10 | Language |
| 11 | Country |
| 12 | Awards |
| 13 | Poster |
| 14 | Ratings |
| 15 | Metascore |
| 16 | imdbRating |
| 17 | imdbVotes |
| 18 | imdbID |
| 19 | Type |
| 20 | DVD |
| 21 | BoxOffice |
| 22 | Production |
| 23 | Website |
| 24 | Response |
| 25 | Error |
| 26 | totalSeasons |
film_data.shape
(265, 27)
ordered_df = pd.read_csv("ordered.csv", sep="\r")
ordered_df.sort_index(ascending=False).reset_index(drop=True)
| Title | |
|---|---|
| 0 | Any Given Sunday |
| 1 | Blue Chips |
| 2 | Moneyball |
| 3 | White Men Can't Jump |
| 4 | Heat |
| ... | ... |
| 259 | Cruising |
| 260 | Blow Out |
| 261 | Body Heat |
| 262 | Planes, Trains, and Automobiles |
| 263 | Man on Fire |
264 rows × 1 columns
ordered_df.Title = ordered_df.Title.replace({
"Tango and Cash": "Tango & Cash",
"Raiders of the Lost Ark": "Indiana Jones and the Raiders of the Lost Ark",
"Love and Basketball": "Love & Basketball",
"Stand By Me": "Stand by Me",
"Remember The Titans": "Remember the Titans",
"Do The Right Thing": "Do the Right Thing",
"When Harry Met Sally": "When Harry Met Sally...",
"Ocean's 11": "Ocean's Eleven",
"Ocean's 12": "Ocean's Twelve",
"Any Given Sunday": "Any Given Sunday",
"Escape From New York": "Escape from New York",
"Planes, Trains, and Automobiles": "Planes, Trains & Automobiles",
})
film_data = film_data.set_index("Title").loc[ordered_df.Title.values].reset_index().iloc[::-1]
film_data.Title
263 Any Given Sunday
262 Blue Chips
261 Moneyball
260 White Men Can't Jump
259 Heat
...
4 Cruising
3 Blow Out
2 Body Heat
1 Planes, Trains & Automobiles
0 Man on Fire
Name: Title, Length: 264, dtype: object
px.histogram(
x=film_data.Released.value_counts().resample("1Y").count().index,
y=film_data.Released.value_counts().resample("1Y").count(),
nbins=50,
)
decades_df = film_data.Released.value_counts().resample("10Y").count()
decades_df.index = decades_df.index.year - 9
px.histogram(
x=decades_df.index,
y=decades_df,
nbins=20,
)
fig = px.histogram(
x=film_data.Year.value_counts().head().index,
y=film_data.Year.value_counts().head(),
)
fig.update_layout(xaxis_type="category", title="Most popular years")
rolling_window = 15
px.line(pd.concat([
film_data.Year,
film_data.Year.rolling(rolling_window).mean(),
], axis=1, keys=["Release year", f"{rolling_window}-episode rolling average"]))
The Metascore is the weighted-average critic score from Metacritic.
px.histogram(film_data.Metascore, nbins=50)
px.line(pd.concat([
film_data.Metascore,
film_data.Metascore.rolling(rolling_window).mean(),
], axis=1, keys=["Metascore", f"{rolling_window}-episode rolling average"]))
rows_to_show = 10
pd.concat([
film_data.sort_values("Released")[["Title", "Released"]].reset_index(drop=True).head(rows_to_show),
film_data.sort_values("Released")[["Title", "Released"]].reset_index(drop=True).tail(rows_to_show),
])
| Title | Released | |
|---|---|---|
| 0 | Butch Cassidy and the Sundance Kid | 1969-09-24 |
| 1 | The Godfather | 1972-03-24 |
| 2 | The Exorcist | 1973-12-26 |
| 3 | The Godfather Part II | 1974-12-18 |
| 4 | Jaws | 1975-06-20 |
| 5 | Taxi Driver | 1976-02-09 |
| 6 | All the President's Men | 1976-04-09 |
| 7 | Saturday Night Fever | 1977-12-16 |
| 8 | Grease | 1978-06-16 |
| 9 | Halloween | 1978-10-27 |
| 254 | The Martian | 2015-10-02 |
| 255 | Spotlight | 2015-11-20 |
| 256 | Creed | 2015-11-25 |
| 257 | John Wick: Chapter 2 | 2017-02-10 |
| 258 | Get Out | 2017-02-24 |
| 259 | Dunkirk | 2017-07-21 |
| 260 | Den of Thieves | 2018-01-19 |
| 261 | A Star Is Born | 2018-10-05 |
| 262 | Once Upon a Time... In Hollywood | 2019-07-26 |
| 263 | Top Gun: Maverick | 2022-05-27 |
film_data.sort_values("BoxOffice")[["Title", "Year", "BoxOffice"]]
| Title | Year | BoxOffice | |
|---|---|---|---|
| 113 | Kicking and Screaming | 1995 | 718490.0 |
| 164 | King of New York | 1990 | 2554476.0 |
| 186 | Reservoir Dogs | 1992 | 2832029.0 |
| 132 | Swingers | 1996 | 4555020.0 |
| 11 | Margin Call | 2011 | 5354039.0 |
| ... | ... | ... | ... |
| 30 | E.T. the Extra-Terrestrial | 1982 | 437127544.0 |
| 246 | The Dark Knight | 2008 | 534987076.0 |
| 251 | Titanic | 1997 | 659363944.0 |
| 22 | Top Gun: Maverick | 2022 | 691213000.0 |
| 5 | American Gigolo | 1980 | NaN |
264 rows × 3 columns
px.histogram(film_data, x="BoxOffice", nbins=50)
We're going to cover:
winners_to_display = 10
def plot_rankings(by):
fig = px.histogram(
film_data[by].value_counts().reset_index().head(winners_to_display),
x=by,
y="index",
orientation="h",
category_orders={"index": film_data[by].value_counts().index},
)
fig.show()
def get_rankings(by):
display_columns = ["Title", "Genre", "Released"]
return film_data.set_index(by).sort_values("Released").loc[film_data[by].value_counts().index[:winners_to_display], display_columns]
plot_rankings("Director")
get_rankings("Director")
| Title | Genre | Released | |
|---|---|---|---|
| Director | |||
| Tony Scott | Top Gun | Action, Drama | 1986-05-16 |
| Tony Scott | Beverly Hills Cop II | Action, Comedy, Crime | 1987-05-20 |
| Tony Scott | The Last Boy Scout | Action, Comedy, Crime | 1991-12-13 |
| Tony Scott | True Romance | Crime, Drama, Romance | 1993-09-10 |
| Tony Scott | Crimson Tide | Action, Drama, Thriller | 1995-05-12 |
| Tony Scott | Enemy of the State | Action, Thriller | 1998-11-20 |
| Tony Scott | Man on Fire | Action, Crime, Drama | 2004-04-23 |
| Tony Scott | Unstoppable | Action, Thriller | 2010-11-12 |
| David Fincher | Se7en | Crime, Drama, Mystery | 1995-09-22 |
| David Fincher | The Game | Drama, Mystery, Thriller | 1997-09-12 |
| David Fincher | Fight Club | Drama | 1999-10-15 |
| David Fincher | Panic Room | Crime, Drama, Thriller | 2002-03-29 |
| David Fincher | Zodiac | Crime, Drama, Mystery | 2007-03-02 |
| David Fincher | The Social Network | Biography, Drama | 2010-10-01 |
| David Fincher | Gone Girl | Drama, Mystery, Thriller | 2014-10-03 |
| Rob Reiner | Stand by Me | Adventure, Drama | 1986-08-22 |
| Rob Reiner | The Princess Bride | Adventure, Family, Fantasy | 1987-10-09 |
| Rob Reiner | When Harry Met Sally... | Comedy, Drama, Romance | 1989-07-21 |
| Rob Reiner | Misery | Drama, Thriller | 1990-11-30 |
| Rob Reiner | A Few Good Men | Drama, Thriller | 1992-12-11 |
| Rob Reiner | The American President | Comedy, Drama, Romance | 1995-11-17 |
| Michael Mann | Thief | Action, Crime, Drama | 1981-03-27 |
| Michael Mann | Manhunter | Crime, Mystery, Thriller | 1986-08-15 |
| Michael Mann | The Last of the Mohicans | Action, Adventure, Drama | 1992-09-25 |
| Michael Mann | Heat | Action, Crime, Drama | 1995-12-15 |
| Michael Mann | Collateral | Action, Crime, Drama | 2004-08-06 |
| Michael Mann | Miami Vice | Action, Adventure, Crime | 2006-07-28 |
| Martin Scorsese | Taxi Driver | Crime, Drama | 1976-02-09 |
| Martin Scorsese | The Color of Money | Drama, Sport | 1986-10-17 |
| Martin Scorsese | Goodfellas | Biography, Crime, Drama | 1990-09-21 |
| Martin Scorsese | Casino | Crime, Drama | 1995-11-22 |
| Martin Scorsese | The Departed | Crime, Drama, Thriller | 2006-10-06 |
| Martin Scorsese | The Wolf of Wall Street | Biography, Comedy, Crime | 2013-12-25 |
| Steven Spielberg | Jaws | Adventure, Thriller | 1975-06-20 |
| Steven Spielberg | Indiana Jones and the Raiders of the Lost Ark | Action, Adventure | 1981-06-12 |
| Steven Spielberg | E.T. the Extra-Terrestrial | Adventure, Family, Sci-Fi | 1982-06-11 |
| Steven Spielberg | Jurassic Park | Action, Adventure, Sci-Fi | 1993-06-11 |
| Steven Spielberg | Saving Private Ryan | Drama, War | 1998-07-24 |
| Christopher Nolan | Memento | Mystery, Thriller | 2001-05-25 |
| Christopher Nolan | The Dark Knight | Action, Crime, Drama | 2008-07-18 |
| Christopher Nolan | Inception | Action, Adventure, Sci-Fi | 2010-07-16 |
| Christopher Nolan | Dunkirk | Action, Drama, History | 2017-07-21 |
| Steven Soderbergh | Out of Sight | Comedy, Crime, Drama | 1998-06-26 |
| Steven Soderbergh | Ocean's Eleven | Crime, Thriller | 2001-12-07 |
| Steven Soderbergh | Ocean's Twelve | Crime, Thriller | 2004-12-10 |
| Steven Soderbergh | Contagion | Drama, Thriller | 2011-09-09 |
| Oliver Stone | Wall Street | Crime, Drama | 1987-12-11 |
| Oliver Stone | The Doors | Biography, Drama, Music | 1991-03-01 |
| Oliver Stone | JFK | Drama, History, Thriller | 1991-12-20 |
| Oliver Stone | Any Given Sunday | Drama, Sport | 1999-12-22 |
| Spike Lee | Do the Right Thing | Comedy, Drama | 1989-07-21 |
| Spike Lee | 25th Hour | Drama | 2003-01-10 |
| Spike Lee | Inside Man | Crime, Drama, Mystery | 2006-03-24 |
plot_rankings("Writer")
get_rankings("Writer")
| Title | Genre | Released | |
|---|---|---|---|
| Writer | |||
| John Hughes | Mr. Mom | Comedy, Drama | 1983-08-19 |
| John Hughes | The Breakfast Club | Comedy, Drama | 1985-02-15 |
| John Hughes | Ferris Bueller's Day Off | Comedy | 1986-06-11 |
| John Hughes | Planes, Trains & Automobiles | Comedy, Drama | 1987-11-25 |
| John Hughes | Home Alone | Comedy, Family | 1990-11-16 |
| Cameron Crowe | Say Anything | Comedy, Drama, Romance | 1989-04-14 |
| Cameron Crowe | Singles | Comedy, Drama, Music | 1992-09-18 |
| Cameron Crowe | Jerry Maguire | Comedy, Drama, Romance | 1996-12-13 |
| Ron Shelton | White Men Can't Jump | Comedy, Sport | 1992-03-27 |
| Ron Shelton | Blue Chips | Drama, Sport | 1994-02-18 |
| Chris Morgan, Gary Scott Thompson | Fast Five | Action, Crime, Thriller | 2011-04-29 |
| Chris Morgan, Gary Scott Thompson | Furious 7 | Action, Crime, Thriller | 2015-04-03 |
| John Singleton | Boyz n the Hood | Crime, Drama | 1991-07-12 |
| John Singleton | Higher Learning | Crime, Drama, Thriller | 1995-01-11 |
| Aaron Sorkin | A Few Good Men | Drama, Thriller | 1992-12-11 |
| Aaron Sorkin | The American President | Comedy, Drama, Romance | 1995-11-17 |
| Lawrence Kasdan | Body Heat | Crime, Drama, Romance | 1981-08-28 |
| Lawrence Kasdan | The Bodyguard | Action, Drama, Music | 1992-11-25 |
| Mario Puzo, Francis Ford Coppola | The Godfather | Crime, Drama | 1972-03-24 |
| Mario Puzo, Francis Ford Coppola | The Godfather Part III | Crime, Drama | 1990-12-25 |
| David Mamet | Glengarry Glen Ross | Crime, Drama, Mystery | 1992-10-02 |
| David Mamet | The Edge | Action, Adventure, Drama | 1997-09-26 |
| Nicholas Pileggi, Martin Scorsese | Goodfellas | Biography, Crime, Drama | 1990-09-21 |
| Nicholas Pileggi, Martin Scorsese | Casino | Crime, Drama | 1995-11-22 |
film_data[["Actor_1", "Actor_2", "Actor_3"]] = film_data.Actors.str.split(", ", expand=True)
plot_rankings("Actor_1")
get_rankings("Actor_1")
| Title | Genre | Released | |
|---|---|---|---|
| Actor_1 | |||
| Tom Cruise | Top Gun | Action, Drama | 1986-05-16 |
| Tom Cruise | Cocktail | Comedy, Drama, Romance | 1988-07-29 |
| Tom Cruise | A Few Good Men | Drama, Thriller | 1992-12-11 |
| Tom Cruise | The Firm | Drama, Mystery, Thriller | 1993-06-30 |
| Tom Cruise | Mission: Impossible | Action, Adventure, Thriller | 1996-05-22 |
| Tom Cruise | Jerry Maguire | Comedy, Drama, Romance | 1996-12-13 |
| Tom Cruise | Collateral | Action, Crime, Drama | 2004-08-06 |
| Tom Cruise | Edge of Tomorrow | Action, Adventure, Sci-Fi | 2014-06-06 |
| Tom Cruise | Top Gun: Maverick | Action, Drama | 2022-05-27 |
| Al Pacino | The Godfather Part II | Crime, Drama | 1974-12-18 |
| Al Pacino | Cruising | Crime, Drama, Mystery | 1980-02-15 |
| Al Pacino | The Godfather Part III | Crime, Drama | 1990-12-25 |
| Al Pacino | Glengarry Glen Ross | Crime, Drama, Mystery | 1992-10-02 |
| Al Pacino | Scent of a Woman | Drama | 1993-01-08 |
| Al Pacino | Heat | Action, Crime, Drama | 1995-12-15 |
| Al Pacino | Any Given Sunday | Drama, Sport | 1999-12-22 |
| Tom Hanks | A League of Their Own | Comedy, Drama, Sport | 1992-07-01 |
| Tom Hanks | Forrest Gump | Drama, Romance | 1994-07-06 |
| Tom Hanks | Toy Story | Animation, Adventure, Comedy | 1995-11-22 |
| Tom Hanks | Saving Private Ryan | Drama, War | 1998-07-24 |
| Tom Hanks | You've Got Mail | Comedy, Drama, Romance | 1998-12-18 |
| Tom Hanks | Cast Away | Adventure, Drama, Romance | 2000-12-22 |
| Sylvester Stallone | Rocky III | Drama, Sport | 1982-05-28 |
| Sylvester Stallone | First Blood | Action, Adventure, Thriller | 1982-10-22 |
| Sylvester Stallone | Rocky IV | Drama, Sport | 1985-11-27 |
| Sylvester Stallone | Cobra | Action, Crime, Thriller | 1986-05-23 |
| Sylvester Stallone | Tango & Cash | Action, Comedy, Crime | 1989-12-22 |
| Sylvester Stallone | Cop Land | Crime, Drama, Thriller | 1997-08-15 |
| Leonardo DiCaprio | Titanic | Drama, Romance | 1997-12-19 |
| Leonardo DiCaprio | The Departed | Crime, Drama, Thriller | 2006-10-06 |
| Leonardo DiCaprio | Inception | Action, Adventure, Sci-Fi | 2010-07-16 |
| Leonardo DiCaprio | The Wolf of Wall Street | Biography, Comedy, Crime | 2013-12-25 |
| Leonardo DiCaprio | Once Upon a Time... In Hollywood | Comedy, Drama | 2019-07-26 |
| Kevin Costner | The Untouchables | Crime, Drama, Thriller | 1987-06-03 |
| Kevin Costner | Field of Dreams | Drama, Family, Fantasy | 1989-05-05 |
| Kevin Costner | JFK | Drama, History, Thriller | 1991-12-20 |
| Kevin Costner | The Bodyguard | Action, Drama, Music | 1992-11-25 |
| Kevin Costner | Draft Day | Drama, Sport | 2014-04-11 |
| Denzel Washington | Remember the Titans | Biography, Drama, Sport | 2000-09-29 |
| Denzel Washington | Training Day | Action, Crime, Drama | 2001-10-05 |
| Denzel Washington | Man on Fire | Action, Crime, Drama | 2004-04-23 |
| Denzel Washington | Inside Man | Crime, Drama, Mystery | 2006-03-24 |
| Denzel Washington | Unstoppable | Action, Thriller | 2010-11-12 |
| Arnold Schwarzenegger | The Terminator | Action, Sci-Fi | 1984-10-26 |
| Arnold Schwarzenegger | Commando | Action, Adventure, Thriller | 1985-10-04 |
| Arnold Schwarzenegger | Predator | Action, Adventure, Horror | 1987-06-12 |
| Arnold Schwarzenegger | Total Recall | Action, Adventure, Sci-Fi | 1990-06-01 |
| Arnold Schwarzenegger | Terminator 2: Judgment Day | Action, Sci-Fi | 1991-07-03 |
| George Clooney | Out of Sight | Comedy, Crime, Drama | 1998-06-26 |
| George Clooney | The Perfect Storm | Action, Adventure, Drama | 2000-06-30 |
| George Clooney | Ocean's Eleven | Crime, Thriller | 2001-12-07 |
| George Clooney | Ocean's Twelve | Crime, Thriller | 2004-12-10 |
| George Clooney | Michael Clayton | Crime, Drama, Mystery | 2007-10-12 |
| Robert De Niro | Taxi Driver | Crime, Drama | 1976-02-09 |
| Robert De Niro | Midnight Run | Action, Comedy, Crime | 1988-07-20 |
| Robert De Niro | Goodfellas | Biography, Crime, Drama | 1990-09-21 |
| Robert De Niro | Casino | Crime, Drama | 1995-11-22 |
| Robert De Niro | Ronin | Action, Crime, Thriller | 1998-09-25 |
plot_rankings("Actor_2")
get_rankings("Actor_2")
| Title | Genre | Released | |
|---|---|---|---|
| Actor_2 | |||
| Matt Damon | School Ties | Drama | 1992-09-18 |
| Matt Damon | Good Will Hunting | Drama, Romance | 1998-01-09 |
| Matt Damon | Saving Private Ryan | Drama, War | 1998-07-24 |
| Matt Damon | The Bourne Identity | Action, Mystery, Thriller | 2002-06-14 |
| Matt Damon | The Departed | Crime, Drama, Thriller | 2006-10-06 |
| Brad Pitt | Se7en | Crime, Drama, Mystery | 1995-09-22 |
| Brad Pitt | Ocean's Eleven | Crime, Thriller | 2001-12-07 |
| Brad Pitt | Ocean's Twelve | Crime, Thriller | 2004-12-10 |
| Brad Pitt | Once Upon a Time... In Hollywood | Comedy, Drama | 2019-07-26 |
| Sharon Stone | Total Recall | Action, Adventure, Sci-Fi | 1990-06-01 |
| Sharon Stone | Basic Instinct | Drama, Mystery, Thriller | 1992-03-20 |
| Sharon Stone | Casino | Crime, Drama | 1995-11-22 |
| Gwyneth Paltrow | The Talented Mr. Ripley | Crime, Drama, Thriller | 1999-12-25 |
| Gwyneth Paltrow | The Royal Tenenbaums | Comedy, Drama | 2002-01-04 |
| Gwyneth Paltrow | Country Strong | Drama, Music | 2011-01-07 |
| Paul Walker | The Fast and the Furious | Action, Adventure, Crime | 2001-06-22 |
| Paul Walker | Fast Five | Action, Crime, Thriller | 2011-04-29 |
| Paul Walker | Furious 7 | Action, Crime, Thriller | 2015-04-03 |
| Meg Ryan | When Harry Met Sally... | Comedy, Drama, Romance | 1989-07-21 |
| Meg Ryan | The Doors | Biography, Drama, Music | 1991-03-01 |
| Meg Ryan | You've Got Mail | Comedy, Drama, Romance | 1998-12-18 |
| Linda Hamilton | The Terminator | Action, Sci-Fi | 1984-10-26 |
| Linda Hamilton | Terminator 2: Judgment Day | Action, Sci-Fi | 1991-07-03 |
| Robin Wright | Forrest Gump | Drama, Romance | 1994-07-06 |
| Robin Wright | Moneyball | Biography, Drama, Sport | 2011-09-23 |
| Jon Voight | Mission: Impossible | Action, Adventure, Thriller | 1996-05-22 |
| Jon Voight | Varsity Blues | Comedy, Drama, Romance | 1999-01-15 |
| Jonah Hill | Superbad | Comedy | 2007-08-17 |
| Jonah Hill | The Wolf of Wall Street | Biography, Comedy, Crime | 2013-12-25 |
plot_rankings("Actor_3")
get_rankings("Actor_3")
| Title | Genre | Released | |
|---|---|---|---|
| Actor_3 | |||
| Rachel McAdams | Mean Girls | Comedy | 2004-04-30 |
| Rachel McAdams | The Notebook | Drama, Romance | 2004-06-25 |
| Rachel McAdams | Wedding Crashers | Comedy, Romance | 2005-07-15 |
| Rachel McAdams | Spotlight | Biography, Crime, Drama | 2015-11-20 |
| Paul Rudd | The 40-Year-Old Virgin | Comedy, Romance | 2005-08-19 |
| Paul Rudd | Knocked Up | Comedy, Romance | 2007-06-01 |
| Paul Rudd | Forgetting Sarah Marshall | Comedy, Drama, Romance | 2008-04-18 |
| Jude Law | The Talented Mr. Ripley | Crime, Drama, Thriller | 1999-12-25 |
| Jude Law | The Holiday | Comedy, Romance | 2006-12-08 |
| Jude Law | Contagion | Drama, Thriller | 2011-09-09 |
| Joe Pesci | Lethal Weapon 2 | Action, Crime, Thriller | 1989-07-07 |
| Joe Pesci | Goodfellas | Biography, Crime, Drama | 1990-09-21 |
| Joe Pesci | Casino | Crime, Drama | 1995-11-22 |
| Joan Allen | Manhunter | Crime, Mystery, Thriller | 1986-08-15 |
| Joan Allen | Face/Off | Action, Crime, Sci-Fi | 1997-06-27 |
| Dwayne Johnson | Fast Five | Action, Crime, Thriller | 2011-04-29 |
| Dwayne Johnson | Furious 7 | Action, Crime, Thriller | 2015-04-03 |
| Gary Busey | Lethal Weapon | Action, Crime, Thriller | 1987-03-06 |
| Gary Busey | Point Break | Action, Crime, Thriller | 1991-07-12 |
| Jeff Goldblum | Jurassic Park | Action, Adventure, Sci-Fi | 1993-06-11 |
| Jeff Goldblum | Independence Day | Action, Adventure, Sci-Fi | 1996-07-03 |
| Elisabeth Shue | The Karate Kid | Action, Drama, Family | 1984-06-22 |
| Elisabeth Shue | Cocktail | Comedy, Drama, Romance | 1988-07-29 |
| Kevin Spacey | Se7en | Crime, Drama, Mystery | 1995-09-22 |
| Kevin Spacey | Margin Call | Drama, Thriller | 2011-09-29 |
actors_df = pd.concat([
film_data.Actor_1.value_counts(),
film_data.Actor_2.value_counts(),
film_data.Actor_3.value_counts(),
], axis=1)
actors_df["Overall"] = actors_df.sum(axis=1)
actors_df.sort_values("Overall", ascending=False).head(30).fillna("")
| Actor_1 | Actor_2 | Actor_3 | Overall | |
|---|---|---|---|---|
| Tom Cruise | 9.0 | 2.0 | 11.0 | |
| Matt Damon | 4.0 | 5.0 | 9.0 | |
| Robert De Niro | 5.0 | 2.0 | 1.0 | 8.0 |
| Al Pacino | 7.0 | 1.0 | 8.0 | |
| Sylvester Stallone | 6.0 | 2.0 | 8.0 | |
| Brad Pitt | 3.0 | 4.0 | 7.0 | |
| Denzel Washington | 5.0 | 1.0 | 6.0 | |
| Gene Hackman | 3.0 | 2.0 | 1.0 | 6.0 |
| Tom Hanks | 6.0 | 6.0 | ||
| Leonardo DiCaprio | 5.0 | 5.0 | ||
| Eddie Murphy | 4.0 | 1.0 | 5.0 | |
| Julia Roberts | 2.0 | 1.0 | 2.0 | 5.0 |
| Ben Affleck | 3.0 | 2.0 | 5.0 | |
| Kevin Costner | 5.0 | 5.0 | ||
| George Clooney | 5.0 | 5.0 | ||
| Michael Douglas | 4.0 | 1.0 | 5.0 | |
| Arnold Schwarzenegger | 5.0 | 5.0 | ||
| Meg Ryan | 1.0 | 3.0 | 4.0 | |
| Jodie Foster | 2.0 | 1.0 | 1.0 | 4.0 |
| Paul Walker | 3.0 | 1.0 | 4.0 | |
| Nicolas Cage | 2.0 | 2.0 | 4.0 | |
| Rachel McAdams | 4.0 | 4.0 | ||
| Bill Murray | 3.0 | 1.0 | 4.0 | |
| Joe Pesci | 1.0 | 3.0 | 4.0 | |
| Will Smith | 4.0 | 4.0 | ||
| Jack Nicholson | 1.0 | 2.0 | 1.0 | 4.0 |
| John Travolta | 4.0 | 4.0 | ||
| Kurt Russell | 3.0 | 1.0 | 4.0 | |
| Bruce Willis | 4.0 | 4.0 | ||
| James Caan | 3.0 | 1.0 | 4.0 |
film_data[["Genre_1", "Genre_2", "Genre_3"]] = film_data.Genre.str.split(", ", expand=True)
plot_rankings("Genre_1")
plot_rankings("Genre_2")
plot_rankings("Genre_3")
genres_df = pd.concat([
film_data.Genre_1.value_counts(),
film_data.Genre_2.value_counts(),
film_data.Genre_3.value_counts(),
], axis=1)
genres_df["Overall"] = genres_df.sum(axis=1)
genres_df.sort_values("Overall", ascending=False).fillna("")
| Genre_1 | Genre_2 | Genre_3 | Overall | |
|---|---|---|---|---|
| Drama | 51.0 | 89.0 | 22.0 | 162.0 |
| Comedy | 72.0 | 12.0 | 1.0 | 85.0 |
| Crime | 35.0 | 32.0 | 11.0 | 78.0 |
| Action | 75.0 | 75.0 | ||
| Thriller | 17.0 | 44.0 | 61.0 | |
| Romance | 19.0 | 27.0 | 46.0 | |
| Adventure | 10.0 | 25.0 | 35.0 | |
| Mystery | 1.0 | 10.0 | 11.0 | 22.0 |
| Sport | 13.0 | 9.0 | 22.0 | |
| Sci-Fi | 1.0 | 2.0 | 13.0 | 16.0 |
| Biography | 12.0 | 1.0 | 13.0 | |
| Music | 5.0 | 4.0 | 9.0 | |
| Horror | 6.0 | 1.0 | 1.0 | 8.0 |
| Family | 5.0 | 2.0 | 7.0 | |
| History | 2.0 | 3.0 | 5.0 | |
| Fantasy | 2.0 | 3.0 | 5.0 | |
| War | 2.0 | 2.0 | 4.0 | |
| Western | 2.0 | 2.0 | ||
| Animation | 1.0 | 1.0 | ||
| Musical | 1.0 | 1.0 |
film_data.loc[(film_data.Genre_1 == "Animation") | (film_data.Genre_2 == "Musical"), ["Title", "Director", "Year"]]
| Title | Director | Year | |
|---|---|---|---|
| 107 | Toy Story | John Lasseter | 1995 |
| 16 | Grease | Randal Kleiser | 1978 |
pd.DataFrame(repeat_episodes, columns=["Title", "Hosts"])
| Title | Hosts | |
|---|---|---|
| 0 | Titanic | Bill Simmons and Van Lathan |
| 1 | The Re-Departed | Bill Simmons, Chris Ryan, and Sean Fennessey |
| 2 | The Three-Heat | Bill Simmons, Chris Ryan, and Michael Mann |
| 3 | The Re-Heat | Bill Simmons and Chris Ryan |
pd.DataFrame(tv_shows, columns=["Title", "Hosts"])
| Title | Hosts | |
|---|---|---|
| 0 | Miami Vice: Calderones Return (Part 1 + 2) | Bill Simmons and Chris Ryan |
host_df = unique_episodes_df.copy()
host_df.Hosts = host_df.Hosts.str.replace("and ", ",").str.replace(", ,", ", ").str.replace(" ,", ", ")
host_df = host_df.Hosts.str.split(", ", expand=True).stack().reset_index()[0].value_counts().reset_index()
host_df.columns = ["Host", "Number_of_episodes"]
host_df["Percentage_of_episodes"] = host_df.Number_of_episodes / len(unique_episodes)
host_df.shape[0]
50
px.histogram(
host_df.head(winners_to_display),
y="Host",
x="Number_of_episodes",
orientation="h",
category_orders={"Host": host_df.head(winners_to_display).Host.values},
)
host_df.head(winners_to_display)
| Host | Number_of_episodes | Percentage_of_episodes | |
|---|---|---|---|
| 0 | Bill Simmons | 230 | 0.871212 |
| 1 | Chris Ryan | 150 | 0.568182 |
| 2 | Sean Fennessey | 106 | 0.401515 |
| 3 | Shea Serrano | 32 | 0.121212 |
| 4 | Amanda Dobbins | 29 | 0.109848 |
| 5 | Van Lathan | 25 | 0.094697 |
| 6 | Juliet Litman | 22 | 0.083333 |
| 7 | Mallory Rubin | 21 | 0.079545 |
| 8 | Wesley Morris | 17 | 0.064394 |
| 9 | Jason Concepcion | 16 | 0.060606 |